package com.alks.function.controller.finance.salary;

import com.alks.common.aop.ApiRestController;
import com.alks.common.aop.WebLogger;
import com.alks.entity.data.response.ResponseInfo;
import com.alks.function.data.request.finance.salary.PcCostDetail2AddRequest;
import com.alks.function.data.request.finance.salary.PcCostDetail2Request;
import com.alks.function.data.request.finance.salary.PcCostDetail2UpdateRequest;
import com.alks.function.data.request.finance.salary.PcCostTypeRequest;
import com.alks.function.service.finance.salary.SubsidyDeductionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

@ApiRestController("/salaryFile")
@Api(tags = {"工厂-人事薪资作业-补贴扣款作业"})
@Slf4j
public class SubsidyDeductionController {

    @Resource
    private SubsidyDeductionService subsidyDeductionService;

    @WebLogger
    @ApiOperation(value = "扣款明细查询",tags = "工厂-人事薪资作业-补贴扣款作业")
    @PostMapping("/SubsidyDeductionQuery")
    public ResponseInfo SubsidyDeductionQuery(@RequestBody PcCostDetail2Request request) {
        return subsidyDeductionService.SubsidyDeductionQuery(request);
    }

    @WebLogger
    @ApiOperation(value = "检核作业-0审核/1取消",tags = "工厂-人事薪资作业-补贴扣款作业")
    @PutMapping("/InspectionWork/{choose}")
    public ResponseInfo InspectionWork(@RequestBody PcCostDetail2Request request, @PathVariable("choose") Integer choose) {
        return subsidyDeductionService.InspectionWork(request,choose);
    }

    @WebLogger
    @ApiOperation(value = "扣款/补贴定义方式-查询",tags = "工厂-人事薪资作业-补贴扣款作业")
    @GetMapping("/DeductionDefinition")
    public ResponseInfo DeductionDefinition(@RequestParam@ApiParam("默认1 ,查询2") Integer flag) {
        return subsidyDeductionService.DeductionDefinition(flag);
    }

    @WebLogger
    @ApiOperation(value = "扣款/补贴定义方式-新增",tags = "工厂-人事薪资作业-补贴扣款作业")
    @PostMapping("/pcCostTypeAdd")
    public ResponseInfo pcCostTypeAdd(@RequestBody PcCostTypeRequest request) {
        return subsidyDeductionService.pcCostTypeAdd(request);
    }

    @WebLogger
    @ApiOperation(value = "扣款/补贴定义方式-删除",tags = "工厂-人事薪资作业-补贴扣款作业")
    @PostMapping("/pcCostTypeDel")
    public ResponseInfo pcCostTypeDel(@RequestBody PcCostTypeRequest request) {
        return subsidyDeductionService.pcCostTypeDel(request);
    }

    @WebLogger
    @ApiOperation(value = "员工列表",tags = "工厂-人事薪资作业-补贴扣款作业")
    @GetMapping("/getEmployeeList")
    public ResponseInfo geEmployeeList() {
        return subsidyDeductionService.getEmployeeList();
    }

    @WebLogger
    @ApiOperation(value = "增加",tags = "工厂-人事薪资作业-补贴扣款作业")
    @PostMapping("/PcCostDetail2Add")
    public ResponseInfo PcCostDetail2Add(@RequestBody PcCostDetail2AddRequest request) {
        return subsidyDeductionService.PcCostDetail2Add(request);
    }

    @WebLogger
    @ApiOperation(value = "修改",tags = "工厂-人事薪资作业-补贴扣款作业")
    @GetMapping("/PcCostDetail2Update")
    public ResponseInfo PcCostDetail2Update(@RequestParam String id) {
        return subsidyDeductionService.PcCostDetail2Update(id);
    }

    @WebLogger
    @ApiOperation(value = "删除",tags = "工厂-人事薪资作业-补贴扣款作业")
    @PostMapping("/PcCostDetail2Del")
    public ResponseInfo PcCostDetail2Del(@RequestBody List<Integer> ids) {
        return subsidyDeductionService.PcCostDetail2Del(ids);
    }

    @WebLogger
    @ApiOperation(value = "修改结算方式",tags = "工厂-人事薪资作业-补贴扣款作业")
    @PutMapping("/PcCostDetail2Update2/{choose}")
    public ResponseInfo PcCostDetail2Update2(@PathVariable@ApiParam("喜得狼 1,荣阳 2") Integer choose,@RequestBody List<PcCostDetail2UpdateRequest> list) {
        return subsidyDeductionService.PcCostDetail2Update2(list,choose);
    }

    @WebLogger
    @ApiOperation(value = "导出",tags = "工厂-人事薪资作业-补贴扣款作业")
    @PostMapping("/PcCostDetail2Export")
    public void PcCostDetail2Export(@RequestBody PcCostDetail2Request request, HttpServletResponse response) {
        subsidyDeductionService.PcCostDetail2Export(request,response);
    }

    @WebLogger
    @ApiOperation(value = "导入",tags = "工厂-人事薪资作业-补贴扣款作业")
    @PostMapping("/PcCostDetail2Import")
    public ResponseInfo PcCostDetail2Import(@RequestParam MultipartFile file,PcCostDetail2AddRequest request) {
        return subsidyDeductionService.PcCostDetail2Import(file,request);
    }

    @WebLogger
    @ApiOperation(value = "修改备注信息",tags = "工厂-人事薪资作业-补贴扣款作业")
    @PostMapping("/PcCostDetail2UpdateRemarkCw")
    public ResponseInfo PcCostDetail2UpdateRemarkCw(@RequestParam String remarkCw,@RequestParam Integer id) {
        return subsidyDeductionService.PcCostDetail2UpdateRemarkCw(remarkCw,id);
    }

    @WebLogger
    @ApiOperation(value = "考勤生成补贴扣款",tags = "工厂-人事薪资作业-补贴扣款作业")
    @PostMapping("/attendToSubsidyDeductionVNM")
    public ResponseInfo attendToSubsidyDeductionVNM(@RequestParam String yearMonth) {
        return subsidyDeductionService.attendToSubsidyDeductionVNM(yearMonth);
    }
}
